package kii.wapis
{
	public class AsyncToken
	{
		internal var operation:Operation;
		internal var resultCallback:Function;
		internal var faultCallback:Function;
		
		public function AsyncToken(operation:Operation)
		{
			super();
			this.operation = operation;
		}
		
		public function get result():Object
		{
			return operation.result;
		}
		
		public function assign(resultCallback:Function = null, faultCallback:Function = null):AsyncToken
		{
			if(resultCallback != null)
				operation.resultCallback = resultCallback;
			if(faultCallback != null)
				operation.faultCallback = faultCallback;
			return this;
		}
		
		public function kill():void
		{
			operation.kill();
			operation = null;
		}
	}
}